#!/bin/bash
spath=`pwd`
seconfig=/etc/selinux/config
# SELinux status change
echo -e "System SELinux status is `getenforce`."
if [ `getenforce` != "Enforcing" ];then
	echo "SELinux is not in Enforcing mode."
	read -p  "SELinxu should be on Enforing mode to continue. Enable it ? [Y|n]" yesno
	if [ "$yesno" == "Y"  ] || [ "$yesno" == "y" ] || [ "$yesno" == "" ];then
		echo "Enabling SELinux"
		$spath/wreplacer.sh "SELINUX=permissive" "SELINUX=enforcing" "$seconfig"
		$spath/wreplacer.sh "SELINUX=disabled" "SELINUX=enforcing" "$seconfig"
		echo "SELinux has been enabled."
		echo "Note: First reboot after enabling SELinux will take very long time since it required re-labling all the files."
		read -p "Reboot now ? [y|N]" yesno
		if [ "$yesno" == "Y"  ] || [ "$yesno" == "y" ];then
#			/usr/bin/reboot
			echo "Hold on"
		else
			echo "SELinux will be affeting after reboot. Exiting ..."
			exit 0
		fi
	fi
fi

# select service
#todo=$1
#services=(http samba)
#for serv in ${services[@]};do
#	if [ "$todo" == "$serv" ];then
#		
##		break
##	elif [ "$todo" == "all" ];then
##		echo $serv
#	else
#		echo "NOT FOUND"
#	fi
#done
# # select file
